package com.huawei.appgallery.foundation.store.bean.spilt;

import android.content.Context;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.huawei.appgallery.jsonkit.api.JsonBean;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import o.bks;
import o.cga;
import o.cge;

public class DeviceSpec extends JsonBean {
    private String abis_;
    private String deviceFeatures_;
    private int dpi_;
    private String preferLan_;
    private String usesLibrary_;

    public static class e {
        private String[] ˊ;
        private Set<String> ˋ;
        private final Context ˎ;
        private boolean ˏ;
        private boolean ॱ;

        public e(@NonNull Context context) {
            this.ˎ = context;
        }

        public e ˎ(boolean z) {
            this.ॱ = z;
            return this;
        }

        public e ॱ(Set<String> set) {
            this.ˋ = set;
            return this;
        }

        public e ˎ(boolean z, @NonNull String[] strArr) {
            this.ˏ = z;
            this.ˊ = (String[]) Arrays.copyOf(strArr, strArr.length);
            return this;
        }

        @NonNull
        public DeviceSpec ॱ() {
            DeviceSpec deviceSpec = new DeviceSpec();
            deviceSpec.abis_ = bks.ˊ(cge.ˋ(), ",");
            deviceSpec.dpi_ = cge.ˊ(this.ˎ);
            deviceSpec.preferLan_ = ˋ();
            if (this.ॱ) {
                deviceSpec.deviceFeatures_ = cge.ˎ(this.ˎ);
            }
            deviceSpec.usesLibrary_ = cga.ˏ(this.ˎ);
            return deviceSpec;
        }

        private String ˋ() {
            List arrayList = new ArrayList(cge.ˋ(this.ˎ));
            if (this.ˋ != null) {
                for (String str : this.ˋ) {
                    if (!arrayList.contains(str)) {
                        arrayList.add(str);
                    }
                }
            }
            if (this.ˏ) {
                return bks.ˏ(cge.ˏ(arrayList, this.ˊ), ",");
            }
            return bks.ˏ(arrayList, ",");
        }
    }

    private DeviceSpec() {
    }

    boolean ˋ() {
        return TextUtils.isEmpty(this.preferLan_);
    }
}
